This invention relates to a device for reading data code, or an optical data code reader adapted to take an image of an optical data code such as a bar code or a two-dimensional code (hereinafter referred to simply as “code”), to carry out an image processing process on the code within the generated image and to thereby read out the data encoded in this code. In particular, this invention relates to such an optical data code reader provided with the function of adjusting to optimum conditions for taking images and illumination for the readout processing by making use of the generated image.
Most optical data code readers are comprised of an image-taking part including an image-taking element such as a CCD or an MOS and an illuminating part including an LED and are adapted to generate an image in response to a trigger signal and to decode an optical data code in such an image. In order to maintain a high level of readout accuracy with a device of this kind, its image-taking conditions such as the shutter speed and the illumination conditions such as the illumination intensity must be adjusted to optimum conditions. Especially when an optical data code directly marked on the surface of a workpiece by laser light or a marking press is to be read out, the brightness of the image fluctuates significantly because the reflectivity and the propagation direction of the reflected light change, depending upon the surface condition of the workpiece and the marking method. Thus, the image-taking and illumination conditions must be adjusted individually according to the kind of the workpiece and the marking method used for the code.
Adjustments of the kind described above have mostly been carried out manually by a user but since the adjustment setting by such a method is time-consuming and since different operators tend to make adjustments differently, automatic methods for carrying out adjustments are coming to be considered. Methods for automatically adjusting the shutter speed such as AEC (auto-exposure control) and AGC (auto-gain control) may be utilized for the purpose.
Japanese Patent Publication Tokkai 2004-194172 has disclosed a method of optimizing the shutter speed by repeating a plurality of cycles of processes of taking an image of an optical data code, extracting a specified characteristic of a pixel level from the generated image and adjusting the shutter speed based on the extracted characteristic. According to this method, a maximum brightness level is extracted from an image and the shutter level is adjusted until this maximum level reaches a specified numerical range. If there is a portion with a very high reflectivity in the background of an optical data code (corresponding, say, to an edge of or a step on a workpiece), however, the adjustment may be carried out on the basis of the brightness of such a portion and the brightness of the code part may not be optimized.